﻿using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using SinBiota.Model.Entities;

namespace SinBiota.Model.Persistence.Repositories.Interfaces
{
    public interface IRepository<TEntity, in TId> where TEntity : BaseEntity
    {
        TEntity FindById(TId id);        
        TEntity LoadById(TId id);
        IList<TEntity> FindAll();
        void Save(TEntity entity);
        void SaveOrUpdate(TEntity entity);
        void BulkSave(IEnumerable<TEntity> list);
        void Update(TEntity entity);
        void Delete(TEntity entity);
        TEntity FindByEqRestrictionUniqueResult<T>(Expression<Func<TEntity, object>> expression , T value);
        IList<TEntity> FindByEqRestrictionListResult<T>(Expression<Func<TEntity, object>> expression, T value);
        IList<TEntity> FindByPreffix(Expression<Func<TEntity, object>> expression, string preffix);
        IList<TEntity> FindByInffix(Expression<Func<TEntity, object>> expression, string inffix);
        void ReopenSession();

    }
}
